<?
//先通过dirname(__FILE__)获取到当前文件绝对路径，然后再按具体情况用..去控制找到templates文件夹下的header.php
include dirname(__FILE__)."/../templates/header.php";
?>

<script type="text/javascript">

function toEdit(categoryId,contentId)
{
	document.location.href = "<? echo base_url() ?>index.php/content/toEdit/" + categoryId + "/" + contentId ;
}

//确认删除
function SureDel(categoryId,id )
{
	if(confirm("确认删除该文章吗?删除之后将不能恢复!"))
	{
		document.location.href = "<? echo base_url() ?>index.php/content/delete/" + categoryId + "/" + id ;
	}
}

</script>

<table border="0" cellspacing="1" cellpadding="3" align="center" class="title">
<tr>
	<td>管理文章</td>
</tr>
</table>
<table border="0" cellspacing="1" cellpadding="3" align="center" class="dataList">
	<tr>
		<th width="10%" align="center" valign="middle">ID</th>
		<th width="30%" align="center" valign="middle">标题</th>
		<th width="10%" align="center" valign="middle">显示顺序</th>
		<th width="20%" align="center" valign="middle">创建日期</th>
		<th width="15%" align="center" valign="middle">创建者</th>
		<th width="15%" align="center" valign="middle">操作</th>
	</tr>

<?
	$cnt = 0 ;
	foreach($result_array as $row){
		$cnt ++ ;
?>
	<tr>
	  <td align="center" valign="middle">
			<? echo $row['id'] ?>
      </td>
	  <td align="left" valign="middle">
			&nbsp;&nbsp;<? echo $row['title'] ?><? if($row['recommend']==1){ echo "<font color='red'>[推荐]</font>" ; } ?>
      </td>
      <td align="center" valign="middle">
			<? echo $row['order_no'] ?>
      </td>
	  <td align="center" valign="middle">
			<? echo $row['gmt_create'] ?>
      </td>
      <td align="center" valign="middle">
			<? echo $row['user_name'] ?>
      </td>
	  <td align="center" valign="middle">
	  		<input type="button" name="btnUpd" value=" 修 改 " onclick="toEdit('<? echo $row['category_id'] ?>','<? echo $row['id'] ?>')">
			<input type="button" name="btnDel" value=" 删 除 " onclick="SureDel('<? echo $row['category_id'] ?>','<? echo $row['id'] ?>')">
	  </td>
    </tr>
<?
	}
	if($cnt==0){
?>
	<tr>
		<td colspan="5">栏目下还没有文章</td>
	</tr>
<?
	}
?>
</table>

<? if($info != "no"){
?>
<script type='text/javascript'>
	alert("<? echo $info ?>");
</script>
<? } ?>

